import request from '@/utils/request'

//API所在路径
export const BASEURL = process.env.VUE_APP_BASE_OAAPI;

export const procList = (params: any) =>
    request({
        url: '/wk-fw/proc-list',
        method: 'get',
        params
    });

//获取我的待办事宜
export const procMyTodo = (params: any) =>
    request.post('/wk-fw/mytodo', params);
/**
 * 
 * @param params 流程图片
 */
export const procImage = (id: any) =>
    request({
        url: '/wk-fw/img/' + id,
        method: 'get'
    })
/**
 * 
 * @param id 获取流程form属性
 */
export const form = (id: any) =>
    request({
        url: '/wk-fw/form?taskid=' + id,
        method: 'get'
    })

export const startProc = (params: any) => request.post('/wk-fw/startProcessInstanceByDefId', params);
/**
 * 提交一个任务完成
 * @param params 
 */
export const taskComplete = (params: any) => request.post('/wk-fw/taskComplete', params);

/**
 * 历史任务信息
 * @param params 
 */
export const history2task = (params: any) => request({
    url: '/wk-fw/h2t',
    method: 'get',
    params
})
export const wftest = (params: any) => request({ url: '/wk-fw/test' });

/**
 * 获取所有任务列表,带分页
 */
export const taskList = (params: any) => request.post('/wk-fw/task-list', params);

/**
 * 获取所有实例
 */
export const instList = (params: any) => request.post('/wk-fw/inst-list', params)

/**
 * 中断或恢复流程定义
 * @param params 
 */
export const enableOrsuspended = (params: any) => request.post('/wk-fw/enableOrsuspended', params);

/**
 * 删除流程定义
 */
export const destroyProcDef = (params: any) => request.post('/wk-fw/destroyProcDef', params);

/**
 * 添加附件
 * @param params 
 */
// export const addAttachmentFile=(params:any)=>request.post('/wk-fw/addAttachmentFile',params);
/**
 * 文件上传
 * @param params 
 */
export const fileUpload = (params:any) => {
    const url = '/wk-fw/upload'
    // 根据后台需求的数据格式确定headers
    return request.post(url, params, { 
        headers: {"content-type": "multipart/form-data"}
    })
}

/**
 * 文件列表
 * @param params 
 */
export const files=(params:any)=>request.post('/wk-fw/files',params);

